package com.example.weather;

import androidx.fragment.app.Fragment;

import org.xutils.common.Callback;
import org.xutils.http.RequestParams;
import org.xutils.x;

/*
* xutils加载网络数据的步骤
* 1.声明整体模块
* 2.执行网络请求操作
* */
public abstract class BaseFragment extends Fragment implements Callback.CommonCallback {
    public void loadData(String path){
        RequestParams params = new RequestParams(path);
        x.http().get(params,this);
    }
    //获取信息成功
    @Override
    public void onSuccess(Object result) {

    }

    public abstract void onSuccess(String result);

    ///获取信息失败会回调的接口
    @Override
    public void onError(Throwable ex, boolean isOnCallback) {

    }
//取消请求，会调用的接口
    @Override
    public void onCancelled(CancelledException cex) {

    }
//请求完成后
    @Override
    public void onFinished() {

    }
}
